<template>
  <div>
    <el-tabs v-model="activeName" type="border-card" @tab-click="tabClick">
      <el-tab-pane label="待办项目" name="noFinish">
        <no-finish :switch="false" :status="status" ref="noFinish"></no-finish>
      </el-tab-pane>
      <el-tab-pane label="已办项目" name="finish">
        <finish :switch="false" :status="status" ref="finish"></finish>
      </el-tab-pane>
    </el-tabs>
  </div>
</template>
<script>
import NoFinish from './no-finish.vue';
import Finish from './finish.vue';
export default {
  name: 'Unit',
  components: {
    NoFinish, Finish
  },
  props: {

  },
  data () {
    return {
      activeName: 'noFinish',
      status: '1',
    }
  },
  created () {

  },
  mounted () {
    this.init()
  },
  methods: {
    init () {
      if (this.$route.query.path === 'finish') {
        this.activeName = 'finish'
        this.$refs.finish.init()
      } else {
        this.activeName = 'noFinish'
        this.$refs.noFinish.init()
      }
    },
    tabClick (tab) {
      if (tab.name === 'noFinish') {
        this.$refs.noFinish.init()
      } else if (tab.name === 'finish') {
        this.$refs.finish.init()
      }
    }
  },
  computed: {

  }
}
</script>
<style lang="scss" scoped>
</style>
